<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
// 访问器伪造属性
let Lesson={
    lists:[
        {name:'js',score:98},
        {name:'C',score:88},
        {name:'C++',score:79}

    ],
    get total(){
    // 注意箭头函数后面不能跟大括号，否则报错
        return this.lists.reduce((p,i)=>p+i.score,0)
    }
}
console.log(Lesson.total);

</script>
</html>